package main
import "fmt"

func main() {
	var n int
	var sum int
	fmt.Scanf("%d",&n)

	for i:= 1;i<=n;i++ {
		switch {
		case i%3==0:
			sum+=i
		case i%5==0:
			sum+=i
		}
	}
	fmt.Println(sum)
}